package com.hsp.poly_.objpoly;

public class PolyObject {
    public static void main(String[] args) {
        //animal编译类型是Animal,运行类型是Dog
        Animal animal = new Dog();
        animal.cry();/*因为运行时，这时，即执行到该行时,
        animal运行类型是Dog,所以cry是dog的cry*/


        //animal指向Cat
        animal = new Cat();
        animal.cry();
    }
}
